﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Web;
using DHQGHN.DAL.BO.Admin;
using DHQGHN.DAL.Models.Admin;
using DHQGHN.DAL.Models.QTHT;
using DHQGHN.DAL.Models.TDT;
using DHQGHN.DAL.ModelsUpload;

namespace DHQGHN.Services.QTHT
{
    [ServiceContract]
    public interface IAdminService
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIdx"></param>
        /// <returns></returns>
        /// <summary>
        /// phunx1, 20150520: luu thong tin vao bang HouseHold va Address
        /// </summary>
        /// <param name="household"></param>
        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "Authenthication")]
        DAL.Models.Admin.UserModel Authenthication(DAL.Models.Admin.UserModel u);


        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "Register")]
        USER_GROUP_CREATE Register(USER_GROUP_CREATE user);

        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "RegisterUser")]
        USER_GROUP_CREATE RegisterUser(USER_GROUP_CREATE user);

        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "UpdateUser")]
        bool UpdateUser(USER_GROUP_CREATE user);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "ChangePassUser/{PassWord}/{UserName}/{AppCode}")]
        bool ChangePassUser(string PassWord, string UserName, string AppCode);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "ResetPassWordByforget/{UserName}/{Email}/{AppCode}")]
        bool ResetPassWordByforget(string UserName, string Email, string AppCode);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "CheckPassUserName/{PassWord}/{UserName}/{AppCode}")]
        bool CheckPassUserName(string PassWord, string UserName, string AppCode);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "CheckEmail/{Email}/{AppCode}")]
        bool CheckEmail(string Email, string AppCode);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="eaCode"></param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetAllMenuByUserIdAndAppCode/{userId}/{appCode}")]
        IEnumerable<MenuModel> GetAllMenuByUserIdAndAppCode(string userId, string appCode);

        ///// <summary>
        ///// VUONGBD
        ///// 28-05-2015
        ///// </summary>
        ///// <param name="userName"></param>
        ///// <param name="password"></param>
        ///// <returns></returns>
        [OperationContract]
        [WebInvoke(Method = "POST",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "Login")]
        T_Users pLogin(UserUpload user);


        ///// <summary>
        ///// VUONGBD
        ///// 28-05-2015
        ///// </summary>
        ///// <param name="userName"></param>
        ///// <param name="password"></param>
        ///// <returns></returns>
        //[OperationContract]
        //[WebInvoke(Method = "POST",
        //    RequestFormat = WebMessageFormat.Json,
        //    ResponseFormat = WebMessageFormat.Json,
        //    BodyStyle = WebMessageBodyStyle.Bare,
        //    UriTemplate = "Login")]
        //T_Users pLogin();
       

        /// <summary>
        /// VUONGBD
        /// 2015-06-16
        /// </summary>
        /// <param name="UserName"></param>
        /// true : chua ton tai, false : da ton tai
        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "Authenthication/Unique/{UserName}")]
        bool IsUnique(string UserName);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GroupGetAll/{AppCode}")]
        List<GroupModel> GroupGetAll(string AppCode);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetGroupAllByUserName/{UserName}/{AppCode}")]
        List<CheckBoxList> GetGroupAllByUserName(string UserName, string AppCode);

        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "InsertUserIntoGroup")]
        bool InsertUserIntoGroup(USER_GROUP_CREATE us);
        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "deleteUser/{UserName}/{appCode}")]
        bool deleteUser(string UserName, string appCode);


        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "UserInGroupUpdate")]
        UserInGroupUpdate UserInGroupUpdate(UserInGroupUpdate user);

        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "UpdateUserInGroup")]
        UserInGroupUpdate UpdateUserInGroup(UserInGroupUpdate user);

        /// <summary>
        /// quyvd, 20150827: lay cac thong tin groupcode
        /// </summary>
        /// <param name="enumCode"></param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetAllUserGroupCode/{GROUPCODE}")]
        List<ActionGroupCode> GetAllUserGroupCode(string GROUPCODE);

        [WebGet(ResponseFormat=WebMessageFormat.Json, 
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetListActionName/{userName}/{appId}")]
        [OperationContract]
        List<ActionNameModel> GetListActionName(string userName, string appId);

        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "actionCreateOrAddUser")]
        void actionCreateOrAddUser(DAL.Models.Admin.UserModel ea);

        [OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "actionCreateUserInGroupByListGroup")]
        void actionCreateUserInGroupByListGroup(UserInListGroup ea);

    }   
}
